package com.jiazhong.servlet.mapper;

import com.jiazhong.commons.bean.Emp;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface EmpMapper {
    @Select("select * from emp where state=1")
    List<Emp> findAll();
    @Insert("insert into emp values(null,#{ename},#{job},#{mgr},now(),#{sal},#{comm},#{deptNo},1)")
    int save(Emp emp);
    @Update("update emp set ename=#{ename},job=#{job},mgr=#{mgr},sal=#{sal},comm=#{comm},deptno=#{deptNo} where empno=#{empNo}")
    int update(Emp emp);
    @Select("select * from emp where state=1 and empno=#{empNo}")
    Emp findById(int empNo);
    @Delete("update emp set state=0 where empno=#{id}")
    int delete(int id);
    @Select("select * from emp where state=1 and ename like #{ename}")
    List<Emp> findByEname(String ename);
}
